package moreHealthView;
/**
 * 
 */

/**
 * @author Parasuraman Ramakrishnan
 * Assignment Name: Homework1
 * Completed Date: 9/14/2009
 *
 */

import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;

import moreHealthModel.Campus.CampusLocation;
import moreHealthModel.Campus.FoodSources.FastFood;
import moreHealthModel.Campus.FoodSources.Restaurant;
import moreHealthModel.Campus.LearningEnvironment.ClassRoom;
import moreHealthModel.Campus.LearningEnvironment.Library;
import moreHealthModel.Campus.Residences.Residence1;
import moreHealthModel.Campus.Transit.Halls;
import moreHealthModel.Campus.Transit.Sidewalk;
import moreHealthModel.Student.Student;
import moreHealthModel.Student.StudentJourney;
import moreHealthModel.Student.Student.Disease;

public class Main
	{

		/**
		 * Entry point to the Program
		 * @throws IOException 
		 */			   
		
		
		public static void main(String[] args) throws IOException
			{

				
				// TODO Auto-generated method stub
				Student s;
				s= new Student("Aloke", 23, 7, 80, Disease.heartTrouble);
				
				int outputResult= s.CalcSeriousnessFactor(s);
				System.out.println("Student Name: "+s.GetName());
				System.out.println("Student Age: "+s.GetAge());
				System.out.println("Student seriousness: "+outputResult);
				
				StudentJourney sj = new StudentJourney();
				
				sj.setStudentInfo(s);
				sj.setStudentVisitedPlaces(new Halls(0,1, "Hall1", 736));
				sj.setStudentVisitedPlaces(new Sidewalk(1,2, 737));			
				System.out.println (sj.TotalDistanceCalculator(sj.getStudentVisitedPlaces()));
				
				
				
				
				System.out.println("This is the Monitor Input");
				
				StudentJourney studjrny1 = new StudentJourney();
				boolean ans=true;
				

			     
				while (ans==true)
					{
				BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
				
				System.out.println("Please Enter Longitude : ");
				int Longitude= Integer.parseInt(br.readLine());
				
				System.out.println("Please Enter Latitude : ");
				int Latitude= Integer.parseInt(br.readLine());
				
				System.out.println("Please Enter time : ");
				int time = Integer.parseInt(br.readLine());
				
				System.out.println("Please choose the Location Type from the list: 1.Hall 2.Side-Walk 3.Fast-Food 4.Restaurants 5.Residences 6.Library 7.Classrooms");
				String locType="";
				switch(Integer.parseInt(br.readLine()))
							{
						case 1:
							locType = "hall";
							break;
						case 2:
							locType ="sidewalk";
							break;
						case 3:
							locType ="fastfood";
							break;
						case 4:
							locType ="restaurant";
							break;
						case 5:
							locType ="residences";
							break;
						case 6:
							locType ="Library";
							break;
						case 7:
							locType ="ClassRoom";
							break;
							}
				locationType(Longitude,Latitude,time,locType,studjrny1);

				
				System.out.println("Did you travel any where else? Select Y/N: ");
				char res= (char) br.read();
				if (res=='N' || res=='n')
					{ans=false;}

				}
				
				System.out.println("Total Distance travelled is: "+ studjrny1.TotalDistanceCalculator(studjrny1.getStudentVisitedPlaces()));
				System.out.println("Out of while loop and in Main().");
			}

		public static void locationType(int longitude, int latitude, int time, String locationType, StudentJourney stdJrn) throws IOException
		
			{
				BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));
				
				if (locationType.equals("hall"))
					{
						System.out.println("Enter the Hall Address. If there is none leave it blank");
						String halladdrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new Halls(latitude, longitude, halladdrs, time));
					}
				
				else if (locationType.equals("sidewalk"))
					{
						stdJrn.setStudentVisitedPlaces(new Sidewalk(latitude, longitude, time));
					}
				else if (locationType.equals("fastfood"))
					{
						System.out.println("Enter the Fast Food Address. If there is none leave it blank");
						String fastfoodaddrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new FastFood(latitude, longitude, fastfoodaddrs, time));
					}
				else if (locationType.equals("restaurant"))
					{
						System.out.println("Enter the Restaurant Address. If there is none leave it blank");
						String restaddrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new Restaurant(latitude, longitude, restaddrs, time));
					}
				else if (locationType.equals("residences"))
					{
						System.out.println("Enter the Residences Address. If there is none leave it blank");
						String res1addrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new Residence1(latitude, longitude, res1addrs, time));
					}
				else if (locationType.equals("Library"))
					{
						System.out.println("Enter the Library Address. If there is none leave it blank");
						String libaddrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new Library(latitude, longitude, libaddrs, time));
					}
				else if (locationType.equals("ClassRoom"))
					{
						System.out.println("Enter the ClassRoom Address. If there is none leave it blank");
						String classaddrs= br1.readLine();
						stdJrn.setStudentVisitedPlaces(new ClassRoom(latitude, longitude, classaddrs, time));
					}
				 
			}
	}
